package com.liezh.builder.builder;

import com.liezh.builder.builder.product.ASCIIText;

import java.io.UnsupportedEncodingException;

public class ASCIIConverter extends TextConverter {

    private ASCIIText mAsciiText;

    public ASCIIConverter(ASCIIText asciiText) {
        this.mAsciiText = asciiText;
    }

    public ASCIIText convertCharacter(String charset) {
        System.out.println("设置ASCII文本字符集：" + charset);
        mAsciiText.setCharset(charset);
        // TODO 转换content的字符集
        try {
            String content = super.changeCharset(mAsciiText.getContent(), charset);
            mAsciiText.setContent(content);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return mAsciiText;
    }

    public ASCIIText convertFontChange(String font) {
        return null;
    }

    public ASCIIText convertParagraph() {
        return null;
    }

    public ASCIIText getASCIIText() {
        return this.mAsciiText;
    }

}
